Skip to content

Comments

Apply console formatting to CLI user-facing messages#13811

Closed
Copilot wants to merge 4 commits intomainfrom
copilot/apply-console-formatting-errors
Closed

Apply console formatting to CLI user-facing messages#13811
Copilot wants to merge 4 commits intomainfrom
copilot/apply-console-formatting-errors

Conversation

Copy link
Contributor

Copilot AI commented Feb 4, 2026

User-facing CLI messages in interactive workflows and trial commands lacked consistent console formatting, resulting in plain text output without visual hierarchy.

Changes

Applied console.Format*Message() wrappers to 25+ messages across CLI files:

  • add_interactive_engine.go - Engine selection and API key prompts
  • add_interactive_workflow.go - Workflow status checks and verbose output
  • add_interactive_git.go - Manual secret setup instructions
  • add_interactive_orchestrator.go - Workflow addition confirmation
  • add_interactive_secrets.go - Secret detection messages
  • trial_command.go - Execution step formatting
  • add_command.go - Verbose workflow resolution messages

Pattern

// Before
fmt.Fprintf(os.Stderr, "Using coding agent: %s\n", engine)
fmt.Fprintf(os.Stderr, "Found %d existing repository secret(s)\n", count)

// After
fmt.Fprintln(os.Stderr, console.FormatInfoMessage(fmt.Sprintf("Using coding agent: %s", engine)))
fmt.Fprintln(os.Stderr, console.FormatInfoMessage(fmt.Sprintf("Found %d existing repository secret(s)", count)))

Message types: FormatInfoMessage(), FormatVerboseMessage(), FormatSuccessMessage() applied based on context.

Side fixes

  • Added missing console import to add_interactive_secrets.go
  • Fixed testifylint issues in trial_dry_run_test.go (require vs assert for error checks)
Original prompt

This section details on the original issue you should resolve

<issue_title>[Code Quality] Apply console formatting to top 5 CLI error-heavy files</issue_title>
<issue_description>## Description

Apply console.FormatErrorMessage() formatting to the top 5 CLI files with highest unformatted error counts (388 total errors, representing 25% of all unformatted errors in the codebase). Currently only 4.4% (69/1,581) of error output sites use proper console formatting.

Problem

Users see raw Go error messages instead of helpful, formatted guidance. The top 5 CLI files alone contain 388 unformatted errors, creating inconsistent error presentation across user-facing commands.

Suggested Changes

Files to Update (Priority Order)

  1. pkg/cli/add_interactive.go - 107 unformatted errors
  2. pkg/cli/init.go - 100 unformatted errors
  3. pkg/cli/add_command.go - 72 unformatted errors
  4. pkg/cli/audit_report_render.go - 61 unformatted errors
  5. pkg/cli/trial_command.go - 48 unformatted errors

Pattern to Replace

// ❌ BEFORE - Raw error output
if err != nil {
    fmt.Fprintln(os.Stderr, err)
    return err
}

// ✅ AFTER - Console formatted error
if err != nil {
    fmt.Fprintln(os.Stderr, console.FormatErrorMessage(err.Error()))
    return err
}

Also Fix stdout Anti-patterns

// ❌ BEFORE - Error to stdout
if err != nil {
    fmt.Println(err)
    return err
}

// ✅ AFTER - Error to stderr with formatting
if err != nil {
    fmt.Fprintln(os.Stderr, console.FormatErrorMessage(err.Error()))
    return err
}

Success Criteria

  • Update all error outputs in add_interactive.go (107 errors)
  • Update all error outputs in init.go (100 errors)
  • Update all error outputs in add_command.go (72 errors)
  • Update all error outputs in audit_report_render.go (61 errors)
  • Update all error outputs in trial_command.go (48 errors)
  • All fmt.Fprintln(os.Stderr, err)fmt.Fprintln(os.Stderr, console.FormatErrorMessage(err.Error()))
  • Verify no stdout error outputs remain
  • Test commands manually to verify formatting

Manual Testing

# Test each command with intentional errors
./gh-aw init /nonexistent/path
./gh-aw add /invalid/workflow.md
./gh-aw trial nonexistent-workflow
./gh-aw audit 99999999

# Verify errors are colored/formatted in terminal

Impact

388 errors (25% of all unformatted errors) will have proper console formatting, providing maximum user-facing impact.

Source

Extracted from Error Experience Engineering Discussion github/gh-aw#12265

Priority

High - Direct user experience improvement

Estimated Effort

Large (1 week)

AI generated by Discussion Task Miner - Code Quality Improvement Agent

  • expires on Feb 18, 2026, 9:08 PM UTC

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 3 commits February 4, 2026 23:26
… files

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
…tency

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Apply console formatting to top 5 CLI error-heavy files Apply console formatting to CLI user-facing messages Feb 4, 2026
Copilot AI requested a review from pelikhan February 4, 2026 23:34
@pelikhan pelikhan closed this Feb 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Code Quality] Apply console formatting to top 5 CLI error-heavy files

2 participants